home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / libx11 / include / x11 / xresource.h < prev    next >
C/C++ Source or Header  |  1999-01-01  |  11KB  |  389 lines

  1. /* $XConsortium: Xresource.h,v 1.35 91/04/13 10:50:30 rws Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  5. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  6.  
  7.                         All Rights Reserved
  8.  
  9. Permission to use, copy, modify, and distribute this software and its 
  10. documentation for any purpose and without fee is hereby granted, 
  11. provided that the above copyright notice appear in all copies and that
  12. both that copyright notice and this permission notice appear in 
  13. supporting documentation, and that the names of Digital or MIT not be
  14. used in advertising or publicity pertaining to distribution of the
  15. software without specific, written prior permission.  
  16.  
  17. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  19. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  20. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26.  
  27. #ifndef _XRESOURCE_H_
  28. #define _XRESOURCE_H_
  29.  
  30. /* You must include <X11/Xlib.h> before including this file */
  31.  
  32. /****************************************************************
  33.  ****************************************************************
  34.  ***                                                          ***
  35.  ***                                                          ***
  36.  ***          X Resource Manager Intrinsics                   ***
  37.  ***                                                          ***
  38.  ***                                                          ***
  39.  ****************************************************************
  40.  ****************************************************************/
  41.  
  42. _XFUNCPROTOBEGIN
  43.  
  44. /****************************************************************
  45.  *
  46.  * Memory Management
  47.  *
  48.  ****************************************************************/
  49.  
  50. extern char *Xpermalloc(
  51. #if NeedFunctionPrototypes
  52.     unsigned int    /* size */
  53. #endif
  54. );
  55.  
  56. /****************************************************************
  57.  *
  58.  * Quark Management
  59.  *
  60.  ****************************************************************/
  61.  
  62. typedef int     XrmQuark, *XrmQuarkList;
  63. #define NULLQUARK ((XrmQuark) 0)
  64.  
  65. typedef char *XrmString;
  66. #define NULLSTRING ((XrmString) 0)
  67.  
  68. /* find quark for string, create new quark if none already exists */
  69. extern XrmQuark XrmStringToQuark(
  70. #if NeedFunctionPrototypes
  71.     _Xconst char*     /* string */
  72. #endif
  73. );
  74.  
  75. extern XrmQuark XrmPermStringToQuark(
  76. #if NeedFunctionPrototypes
  77.     _Xconst char*     /* string */
  78. #endif
  79. );
  80.  
  81. /* find string for quark */
  82. extern XrmString XrmQuarkToString(
  83. #if NeedFunctionPrototypes
  84.     XrmQuark         /* quark */
  85. #endif
  86. );
  87.  
  88. extern XrmQuark XrmUniqueQuark(
  89. #if NeedFunctionPrototypes
  90.     void
  91. #endif
  92. );
  93.  
  94. #define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0)
  95.  
  96.  
  97. /****************************************************************
  98.  *
  99.  * Conversion of Strings to Lists
  100.  *
  101.  ****************************************************************/
  102.  
  103. typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList;
  104.  
  105. extern void XrmStringToQuarkList(
  106. #if NeedFunctionPrototypes
  107.     _Xconst char*    /* string */,
  108.     XrmQuarkList    /* quarks_return */
  109. #endif
  110. );
  111.  
  112. extern void XrmStringToBindingQuarkList(
  113. #if NeedFunctionPrototypes
  114.     _Xconst char*    /* string */,
  115.     XrmBindingList    /* bindings_return */,
  116.     XrmQuarkList    /* quarks_return */
  117. #endif
  118. );
  119.  
  120. /****************************************************************
  121.  *
  122.  * Name and Class lists.
  123.  *
  124.  ****************************************************************/
  125.  
  126. typedef XrmQuark     XrmName;
  127. typedef XrmQuarkList XrmNameList;
  128. #define XrmNameToString(name)        XrmQuarkToString(name)
  129. #define XrmStringToName(string)        XrmStringToQuark(string)
  130. #define XrmStringToNameList(str, name)    XrmStringToQuarkList(str, name)
  131.  
  132. typedef XrmQuark     XrmClass;
  133. typedef XrmQuarkList XrmClassList;
  134. #define XrmClassToString(class)        XrmQuarkToString(class)
  135. #define XrmStringToClass(class)        XrmStringToQuark(class)
  136. #define XrmStringToClassList(str,class)    XrmStringToQuarkList(str, class)
  137.  
  138.  
  139.  
  140. /****************************************************************
  141.  *
  142.  * Resource Representation Types and Values
  143.  *
  144.  ****************************************************************/
  145.  
  146. typedef XrmQuark     XrmRepresentation;
  147. #define XrmStringToRepresentation(string)   XrmStringToQuark(string)
  148. #define    XrmRepresentationToString(type)   XrmQuarkToString(type)
  149.  
  150. typedef struct {
  151.     unsigned int    size;
  152.     XPointer        addr;
  153. } XrmValue, *XrmValuePtr;
  154.  
  155.  
  156. /****************************************************************
  157.  *
  158.  * Resource Manager Functions
  159.  *
  160.  ****************************************************************/
  161.  
  162. typedef struct _XrmHashBucketRec *XrmHashBucket;
  163. typedef XrmHashBucket *XrmHashTable;
  164. typedef XrmHashTable XrmSearchList[];
  165. typedef struct _XrmHashBucketRec *XrmDatabase;
  166.  
  167.  
  168. extern void XrmDestroyDatabase(
  169. #if NeedFunctionPrototypes
  170.     XrmDatabase        /* database */    
  171. #endif
  172. );
  173.  
  174. extern void XrmQPutResource(
  175. #if NeedFunctionPrototypes
  176.     XrmDatabase*    /* database */,
  177.     XrmBindingList    /* bindings */,
  178.     XrmQuarkList    /* quarks */,
  179.     XrmRepresentation    /* type */,
  180.     XrmValue*        /* value */
  181. #endif
  182. );
  183.  
  184. extern void XrmPutResource(
  185. #if NeedFunctionPrototypes
  186.     XrmDatabase*    /* database */,
  187.     _Xconst char*    /* specifier */,
  188.     _Xconst char*    /* type */,
  189.     XrmValue*        /* value */
  190. #endif
  191. );
  192.  
  193. extern void XrmQPutStringResource(
  194. #if NeedFunctionPrototypes
  195.     XrmDatabase*    /* database */,
  196.     XrmBindingList      /* bindings */,
  197.     XrmQuarkList    /* quarks */,
  198.     _Xconst char*    /* value */
  199. #endif
  200. );
  201.  
  202. extern void XrmPutStringResource(
  203. #if NeedFunctionPrototypes
  204.     XrmDatabase*    /* database */,
  205.     _Xconst char*    /* specifier */,
  206.     _Xconst char*    /* value */
  207. #endif
  208. );
  209.  
  210. extern void XrmPutLineResource(
  211. #if NeedFunctionPrototypes
  212.     XrmDatabase*    /* database */,
  213.     _Xconst char*    /* line */
  214. #endif
  215. );
  216.  
  217. extern  XrmQGetResource(
  218. #if NeedFunctionPrototypes
  219.     XrmDatabase        /* database */,
  220.     XrmNameList        /* quark_name */,
  221.     XrmClassList    /* quark_class */,
  222.     XrmRepresentation*    /* quark_type_return */,
  223.     XrmValue*        /* value_return */
  224. #endif
  225. );
  226.  
  227. extern Bool XrmGetResource(
  228. #if NeedFunctionPrototypes
  229.     XrmDatabase        /* database */,
  230.     _Xconst char*    /* str_name */,
  231.     _Xconst char*    /* str_class */,
  232.     char**        /* str_type_return */,
  233.     XrmValue*        /* value_return */
  234. #endif
  235. );
  236.  
  237. extern Bool XrmQGetSearchList(
  238. #if NeedFunctionPrototypes
  239.     XrmDatabase        /* database */,
  240.     XrmNameList        /* names */,
  241.     XrmClassList    /* classes */,
  242.     XrmSearchList    /* list_return */,
  243.     int            /* list_length */
  244. #endif
  245. );
  246.  
  247. extern Bool XrmQGetSearchResource(
  248. #if NeedFunctionPrototypes
  249.     XrmSearchList    /* list */,
  250.     XrmName        /* name */,
  251.     XrmClass        /* class */,
  252.     XrmRepresentation*    /* type_return */,
  253.     XrmValue*        /* value_return */
  254. #endif
  255. );
  256.  
  257. /****************************************************************
  258.  *
  259.  * Resource Database Management
  260.  *
  261.  ****************************************************************/
  262.  
  263. extern void XrmSetDatabase(
  264. #if NeedFunctionPrototypes
  265.     Display*        /* display */,
  266.     XrmDatabase        /* database */
  267. #endif
  268. );
  269.  
  270. extern XrmDatabase XrmGetDatabase(
  271. #if NeedFunctionPrototypes
  272.     Display*        /* display */
  273. #endif
  274. );
  275.  
  276. extern XrmDatabase XrmGetFileDatabase(
  277. #if NeedFunctionPrototypes
  278.     _Xconst char*    /* filename */
  279. #endif
  280. );
  281.  
  282. extern Status XrmCombineFileDatabase(
  283. #if NeedFunctionPrototypes
  284.     _Xconst char*     /* filename */,
  285.     XrmDatabase*    /* target */,
  286.     Bool        /* override */
  287. #endif
  288. );
  289.  
  290. extern XrmDatabase XrmGetStringDatabase(
  291. #if NeedFunctionPrototypes
  292.     _Xconst char*    /* data */  /*  null terminated string */
  293. #endif
  294. );
  295.  
  296. extern void XrmPutFileDatabase(
  297. #if NeedFunctionPrototypes
  298.     XrmDatabase        /* database */,
  299.     _Xconst char*    /* filename */
  300. #endif
  301. );
  302.  
  303. extern void XrmMergeDatabases(
  304. #if NeedFunctionPrototypes
  305.     XrmDatabase        /* source_db */,
  306.     XrmDatabase*    /* target_db */
  307. #endif
  308. );
  309.  
  310. extern void XrmCombineDatabase(
  311. #if NeedFunctionPrototypes
  312.     XrmDatabase        /* source_db */,
  313.     XrmDatabase*    /* target_db */,
  314.     Bool        /* override */
  315. #endif
  316. );
  317.  
  318. #define XrmEnumAllLevels 0
  319. #define XrmEnumOneLevel  1
  320.  
  321. extern Bool XrmEnumerateDatabase(
  322. #if NeedFunctionPrototypes
  323.     XrmDatabase        /* db */,
  324.     XrmNameList        /* name_prefix */,
  325.     XrmClassList    /* class_prefix */,
  326.     int            /* mode */,
  327.     Bool (*)(
  328. #if NeedNestedPrototypes
  329.          XrmDatabase*    /* db */,
  330.          XrmBindingList    /* bindings */,
  331.          XrmQuarkList    /* quarks */,
  332.          XrmRepresentation*    /* type */,
  333.          XrmValue*        /* value */,
  334.          XPointer        /* closure */
  335. #endif
  336.          )        /* proc */,
  337.     XPointer        /* closure */
  338. #endif
  339. );
  340.  
  341. extern char *XrmLocaleOfDatabase(
  342. #if NeedFunctionPrototypes
  343.     XrmDatabase     /* database */
  344. #endif
  345. );
  346.  
  347.  
  348. /****************************************************************
  349.  *
  350.  * Command line option mapping to resource entries
  351.  *
  352.  ****************************************************************/
  353.  
  354. typedef enum {
  355.     XrmoptionNoArg,    /* Value is specified in OptionDescRec.value        */
  356.     XrmoptionIsArg,     /* Value is the option string itself            */
  357.     XrmoptionStickyArg, /* Value is characters immediately following option */
  358.     XrmoptionSepArg,    /* Value is next argument in argv            */
  359.     XrmoptionResArg,    /* Resource and value in next argument in argv      */
  360.     XrmoptionSkipArg,   /* Ignore this option and the next argument in argv */
  361.     XrmoptionSkipLine,  /* Ignore this option and the rest of argv        */
  362.     XrmoptionSkipNArgs    /* Ignore this option and the next 
  363.                OptionDescRes.value arguments in argv */
  364. } XrmOptionKind;
  365.  
  366. typedef struct {
  367.     char        *option;        /* Option abbreviation in argv        */
  368.     char        *specifier;     /* Resource specifier            */
  369.     XrmOptionKind   argKind;        /* Which style of option it is        */
  370.     XPointer        value;        /* Value to provide if XrmoptionNoArg   */
  371. } XrmOptionDescRec, *XrmOptionDescList;
  372.  
  373.  
  374. extern void XrmParseCommand(
  375. #if NeedFunctionPrototypes
  376.     XrmDatabase*    /* database */,
  377.     XrmOptionDescList    /* table */,
  378.     int            /* table_count */,
  379.     _Xconst char*    /* name */,
  380.     int*        /* argc_in_out */,
  381.     char**        /* argv_in_out */             
  382. #endif
  383. );
  384.  
  385. _XFUNCPROTOEND
  386.  
  387. #endif /* _XRESOURCE_H_ */
  388. /* DON'T ADD STUFF AFTER THIS #endif */
  389.